<template>
  <div
    class="content-card"
    :class="cls"
    :key="item.id"
  >
    <div
      class="card-image"
      :style="{ backgroundImage: `url(${item.image})` }"
    ></div>
    <div class="card-content">
      <h3>{{ item.title }}</h3>
      <div class="card-meta">
        <div class="author-info">
          <img
            :src="item.author.avatar"
            :alt="item.author.name"
            class="author-avatar"
          />
          <div class="card-stats">
            <span class="author-name">{{ item.author.name }}</span>
            <div class="week-view">
              <div class="stat-item">
                <el-icon>
                  <Clock />
                </el-icon>
                <span>{{ item.timeAgo }}</span>
              </div>
              <div class="stat-item">
                <el-icon>
                  <View />
                </el-icon>
                <span>{{ item.views }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import {defineProps } from "vue";
import {  Clock, View } from '@element-plus/icons-vue'
const props = defineProps({
  item: {
    type: Object,
    default: {}
  },
  cls: {
    type: String,
    default: ''
  },
});
</script>
<style lang='scss' scoped>
.content-card {
  padding: 10px;
  background: #414055;
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid #5f4f55;
  transition: all 0.3s ease;
  cursor: pointer;
  box-sizing: border-box;
  &.active{
    border: 2px solid RGBA(227, 66, 52, 1);
  }
  &:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }

  .card-image {
    width: 100%;
    height: 183px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: #4a90e2;
  }

  .card-content {
    padding: 18px 0 2px;
    display: flex;
    flex-direction: column;

    h3 {
      min-height: 55px;
      font-weight: 500;
      font-size: 18px;
      color: #ffffff;
      margin: 0 0 16px 0;
    }

    .card-meta {
      .author-info {
        display: flex;
        align-items: center;
        gap: 8px;

        .author-avatar {
          width: 40px;
          height: 40px;
          border-radius: 50%;
          object-fit: cover;
        }

        .author-name {
          font-size: 16px;
          color: rgba(153, 153, 153, 1);
          font-weight: 500;
        }

        .content-type {
          font-size: 12px;
          color: rgba(255, 255, 255, 0.6);
          background: rgba(255, 255, 255, 0.1);
          padding: 2px 8px;
          border-radius: 12px;
          margin-left: auto;
        }
      }

      .card-stats {
        width: 100%;
        display: flex;
        flex-direction: column;

        .week-view {
          display: flex;
          justify-content: space-between;
        }

        .stat-item {
          display: flex;
          align-items: center;
          gap: 4px;
          font-size: 16px;
          color: rgba(153, 153, 153, 1);

          .el-icon {
            font-size: 17px;
          }
        }
      }
    }
  }
}
</style>